

// 云函数代码
const cloud = require('wx-server-sdk')
cloud.init({
  env: cloud.DYNAMIC_CURRENT_ENV
})

exports.main = async (event, context) => {
  const res = await cloud.cloudPay.unifiedOrder({
    "body" : event.body,//支付主体
    "outTradeNo":event.outTradeNo,//商户单号32未随机字符串
    "spbillCreateIp" : "127.0.0.1",//返回ip默认
    "subMchId" : "1642830176",//关联的商户id
    "totalFee" : event.totalFee,//付款金额/单位分
    "envId": "peiyoukaoliantong-8e910u9ad85580",//云环境id
    "functionName": "pay_success"//通知云函数
  })
  return res
}